<?php /* Smarty version 2.6.18, created on 2016-11-30 18:03:15
         compiled from achieve/achieve.update.tpl.php */ ?>
<?php require_once(SMARTY_CORE_DIR . 'core.load_plugins.php');
smarty_core_load_plugins(array('plugins' => array(array('modifier', 'in_array', 'achieve/achieve.update.tpl.php', 162, false),)), $this); ?>
<?php $_smarty_tpl_vars = $this->_tpl_vars;
$this->_smarty_include(array('smarty_include_tpl_file' => "index.header.tpl.php", 'smarty_include_vars' => array()));
$this->_tpl_vars = $_smarty_tpl_vars;
unset($_smarty_tpl_vars);
 ?>
<link rel="stylesheet" href="static/css/select2.css">
<?php $_smarty_tpl_vars = $this->_tpl_vars;
$this->_smarty_include(array('smarty_include_tpl_file' => "index.left.tpl.php", 'smarty_include_vars' => array()));
$this->_tpl_vars = $_smarty_tpl_vars;
unset($_smarty_tpl_vars);
 ?>
<!--主要内容开始-->
<div class="content-wrapper">
	<section class="content">
		<div class="row">
			<section class="col-lg-12 connectedSortable">
				<div class="box box-default box-solid">
					<form name="myform" action="" method="post" role="form" enctype="multipart/form-data">
						<div class="box-header with-border">
							<span class="fa fa-pencil" style="float:left; font-size:18px; padding-top:3px; color:#3c8dbc;" ></span>
							<p class="box-title">教学成果添加</p>
						</div>
						<div class="box-body">
							<input type="hidden" name="achieve_type" value="<?php echo $this->_tpl_vars['type']; ?>
">
							<div class="form-group">
								<label for="inputPassword3" class="col-md-3 control-label text-right" style="padding-right:0; padding-left:0; font-weight:500;">
									获奖名称：
								</label>
								<div class="input-group col-md-6 col-sm-12 col-xs-12">
									<input type="text" value="<?php echo $this->_tpl_vars['data']['achieve_name']; ?>
" name="achieve_name" class="form-control" required="required"">
								</div>
							</div>
							<?php if ($this->_tpl_vars['type'] == 6): ?>
							<div class="form-group">
								<label for="inputPassword3" class="col-md-3 control-label text-right" style="padding-right:0; padding-left:0; font-weight:500;">
									出版社：
								</label>
								<div class="input-group col-md-6 col-sm-12 col-xs-12">
									<select class="form-control" id="s1" onchange="a()" name="achieve_publish">
										<option value="请选择"> 请选择</option>
										<?php $_from = $this->_tpl_vars['publish_lists']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['key'] => $this->_tpl_vars['value']):
?>
										<option value="<?php echo $this->_tpl_vars['value']['publish_id']; ?>
" <?php if ($this->_tpl_vars['data']['achieve_publish'] == $this->_tpl_vars['value']['publish_id']): ?>selected<?php endif; ?>><?php echo $this->_tpl_vars['value']['publish_name']; ?>
</option>
										<?php endforeach; endif; unset($_from); ?>
										<option value="自定义"> 自定义</option>
									</select>
									<input id="new" class="form-control" placeholder="添加新的" name="resttype_name">
									<span class="btn btn-default" id="add">添加</span>
								</div>
							</div>
							<div class="form-group">
								<label for="inputPassword3" class="col-md-3 control-label text-right" style="padding-right:0; padding-left:0; font-weight:500;">
									书号：
								</label>
								<div class="input-group col-md-6 col-sm-12 col-xs-12">
									<input type="text" value="<?php echo $this->_tpl_vars['data']['achieve_bookno']; ?>
" name="achieve_bookno" class="form-control" required="required">
								</div>
							</div>
							<div class="form-group">
								<label for="inputPassword3" class="col-md-3 control-label text-right" style="padding-right:0; padding-left:0; font-weight:500;">
									所在页：
								</label>
								<div class="input-group col-md-6 col-sm-12 col-xs-12">
									<input type="text" value="<?php echo $this->_tpl_vars['data']['achieve_page']; ?>
" name="achieve_page" class="form-control" required="required">
								</div>
							</div>
							<?php endif; ?>
							<?php if ($this->_tpl_vars['type'] != 6): ?>
							<div class="form-group">
								<label for="inputPassword3" class="col-md-3 control-label text-right" style="padding-right:0; padding-left:0; font-weight:500;">
									主办单位：
								</label>
								<div class="input-group col-md-6 col-sm-12 col-xs-12">
									<input type="text" value="<?php echo $this->_tpl_vars['data']['achieve_unit']; ?>
" name="achieve_unit" class="form-control" required="required">
								</div>
							</div>
							<?php if ($this->_tpl_vars['type'] != 7): ?>
							<div class="form-group">
								<label for="inputPassword3" class="col-md-3 control-label text-right" style="padding-right:0; padding-left:0; font-weight:500;">
									获奖名次：
								</label>
								<div class="input-group col-md-6 col-sm-12 col-xs-12">
									<select class="form-control" name="achieve_rank">
										<?php $_from = $this->_tpl_vars['prize']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['key'] => $this->_tpl_vars['value']):
?>
										<option value="<?php echo $this->_tpl_vars['value']['prize_id']; ?>
" <?php if ($this->_tpl_vars['data']['achieve_rank'] == $this->_tpl_vars['value']['prize_id']): ?>selected<?php endif; ?>> <?php echo $this->_tpl_vars['value']['prize_name']; ?>
</option>
										<?php endforeach; endif; unset($_from); ?>
									</select>
								</div>
							</div>
							<?php else: ?>
							<div class="form-group">
								<label for="inputPassword3" class="col-md-3 control-label text-right" style="padding-right:0; padding-left:0; font-weight:500;">
									第一指导老师：
								</label>
								<div class="input-group col-md-6 col-sm-12 col-xs-12">
									<select class="form-control" name="achieve_teach">
										<?php $_from = $this->_tpl_vars['teachers']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['key'] => $this->_tpl_vars['value']):
?>
										<option value="<?php echo $this->_tpl_vars['value']['staff_id']; ?>
" <?php if ($this->_tpl_vars['data']['achieve_teach'] == $this->_tpl_vars['value']['staff_id']): ?>selected<?php endif; ?>> <?php echo $this->_tpl_vars['value']['staff_name']; ?>
(<?php echo $this->_tpl_vars['value']['staff_number']; ?>
)</option>
										<?php endforeach; endif; unset($_from); ?>
									</select>
								</div>
							</div>
							<div class="form-group">
								<label for="inputPassword3" class="col-md-3 control-label text-right" style="padding-right:0; padding-left:0; font-weight:500;">
									本人名次：
								</label>
								<div class="input-group col-md-6 col-sm-12 col-xs-12">
									<input type="text" value="<?php echo $this->_tpl_vars['data']['achieve_trank']; ?>
" name="achieve_trank" class="form-control" required="required">
								</div>
							</div>
							<?php endif; ?>
							<?php endif; ?>
							<div class="form-group">
								<label for="inputPassword3" class="col-md-3 control-label text-right" style="padding-right:0; padding-left:0; font-weight:500;">
									获奖级别：
								</label>
								<div class="input-group col-md-6 col-sm-12 col-xs-12">
									<select class="form-control" name="achieve_lv">
										<?php $_from = $this->_tpl_vars['prizelv']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['key'] => $this->_tpl_vars['value']):
?>
										<option value="<?php echo $this->_tpl_vars['value']['prizelv_id']; ?>
" <?php if ($this->_tpl_vars['data']['achieve_lv'] == $this->_tpl_vars['value']['prizelv_id']): ?>selected<?php endif; ?>> <?php echo $this->_tpl_vars['value']['prizelv_name']; ?>
</option>
										<?php endforeach; endif; unset($_from); ?>
									</select>
								</div>
							</div>

							<div class="form-group">
								<label for="inputPassword3" class="col-md-3 control-label text-right" style="padding-right:0; padding-left:0; font-weight:500;">
									<?php if ($this->_tpl_vars['type'] == 6): ?>发表者<?php else: ?>获奖人<?php endif; ?>：
								</label>
								<div class="input-group col-md-6 col-sm-12 col-xs-12">
									<?php if ($this->_tpl_vars['type'] == 5): ?><input type="text" name="achieve_owner" id="achieve_owner" value="<?php echo $this->_tpl_vars['data']['achieve_owner']; ?>
" class="form-control" required="required">
									<?php else: ?><select class="form-control" name="achieve_owner">
										<?php $_from = $this->_tpl_vars['teachers']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['key'] => $this->_tpl_vars['value']):
?>
										<option value="<?php echo $this->_tpl_vars['value']['staff_id']; ?>
" <?php if ($this->_tpl_vars['data']['achieve_owner'] == $this->_tpl_vars['value']['staff_id']): ?>selected<?php endif; ?>> <?php echo $this->_tpl_vars['value']['staff_name']; ?>
(<?php echo $this->_tpl_vars['value']['staff_number']; ?>
)</option>
										<?php endforeach; endif; unset($_from); ?>
									</select><?php endif; ?>
								</div>
							</div>

							<div class="form-group">
								<label for="inputPassword3" class="col-md-3 control-label text-right" style="padding-right:0; padding-left:0; font-weight:500;">
									<?php if ($this->_tpl_vars['type'] == 6): ?>发表日期<?php else: ?>获奖日期<?php endif; ?>：
								</label>
								<div class="input-group col-md-6 col-sm-12 col-xs-12">
									<input type="text" value="<?php echo $this->_tpl_vars['data']['achieve_time']; ?>
" class="form-control" name="achieve_time"  id="datepicker" />
									<div class="input-group-addon">
										<i class="fa fa-calendar"></i>
									</div>
								</div>
							</div>
							<?php if ($this->_tpl_vars['type'] == 5): ?>
							<div class="form-group">
								<label for="inputPassword3" class="col-md-3 control-label text-right" style="padding-right:0; padding-left:0; font-weight:500;">
									第一指导老师：
								</label>
								<div class="input-group col-md-6 col-sm-12 col-xs-12">
									<select class="form-control" name="achieve_teach">
										<?php $_from = $this->_tpl_vars['teachers']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['key'] => $this->_tpl_vars['value']):
?>
										<option value="<?php echo $this->_tpl_vars['value']['staff_id']; ?>
" <?php if ($this->_tpl_vars['data']['achieve_teach'] == $this->_tpl_vars['value']['staff_id']): ?>selected<?php endif; ?>> <?php echo $this->_tpl_vars['value']['staff_name']; ?>
(<?php echo $this->_tpl_vars['value']['staff_number']; ?>
)</option>
										<?php endforeach; endif; unset($_from); ?>
									</select>
								</div>
							</div>
							<div class="form-group">
								<label for="inputPassword3" class="col-md-3 control-label text-right" style="padding-right:0; padding-left:0; font-weight:500;">
									其他指导老师：
								</label>
								<div class="input-group col-md-6 col-sm-12 col-xs-12">
									<select class="form-control select2" name="achieve_teachers[]" multiple="multiple" data-placeholder="选择老师（可多选）">
										<?php $_from = $this->_tpl_vars['teachers']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['key'] => $this->_tpl_vars['value']):
?>
										<option value="<?php echo $this->_tpl_vars['value']['staff_id']; ?>
" <?php if (((is_array($_tmp=$this->_tpl_vars['value']['staff_id'])) ? $this->_run_mod_handler('in_array', true, $_tmp, $this->_tpl_vars['data']['achieve_teachers']) : in_array($_tmp, $this->_tpl_vars['data']['achieve_teachers']))): ?>selected<?php endif; ?>> <?php echo $this->_tpl_vars['value']['staff_name']; ?>
(<?php echo $this->_tpl_vars['value']['staff_number']; ?>
)</option>
										<?php endforeach; endif; unset($_from); ?>
									</select>
								</div>
							</div>
							<?php endif; ?>

							<div class="form-group">
								<label for="inputPassword3" class="col-md-3 control-label text-right" style="padding-right:0; padding-left:0; font-weight:500;">
									备注：
								</label>
								<div class="input-group col-md-6 col-sm-12 col-xs-12">
									<input type="text" value="<?php echo $this->_tpl_vars['data']['achieve_remark']; ?>
" name="achieve_remark" class="form-control" required="required">
								</div>
							</div>
							<div class="form-group">
								<label for="inputPassword3" class="col-md-3 control-label text-right" style="padding-right:0; padding-left:0; font-weight:500;">
									附件：
								</label>
								<div class="input-group col-md-6 col-sm-12 col-xs-12">
									<?php if ($this->_tpl_vars['data']['achieve_file'] != ""): ?>
									<br><input type="radio" name="achieve_file_re" value="0" checked>
									<a href="upload/achieve_file/<?php echo $this->_tpl_vars['data']['achieve_file']; ?>
" target="_blank"><?php echo $this->_tpl_vars['data']['achieve_file']; ?>
</a>
									<br><br><input type="radio" name="achieve_file_re" value="1" > 重新上传 <input id="achieve_file" name="achieve_file" type="file" size="60"/>
									<?php else: ?>
									<input id="achieve_file" name="achieve_file" type="file" size="60"/>
									<input type="hidden" name="achieve_file_re" value="1">
									<?php endif; ?>
								</div>
							</div>
							<?php if ($this->_tpl_vars['type'] == 5): ?>
							<div class="form-group">
								<label for="inputPassword3" class="col-md-3 control-label text-right" style="padding-right:0; padding-left:0; font-weight:500;">
									是否同步到指导老师奖：
								</label>
								<div class="input-group col-md-6 col-sm-12 col-xs-12">
									<input type="checkbox"  name="same">
								</div>
							</div>
							<?php endif; ?>
						</div><!--box-body -->
						<div class="box-footer text-center">
							<button class="btn btn-primary" type="submit">保 存 信 息</button>
						</div>
					</form>
				</div><!--box box-default box-solid-->
			</section>

		</div><!--row-->
	</section>
</div>
<!--主要内容结束-->
<?php $_smarty_tpl_vars = $this->_tpl_vars;
$this->_smarty_include(array('smarty_include_tpl_file' => "index.footer.tpl.php", 'smarty_include_vars' => array()));
$this->_tpl_vars = $_smarty_tpl_vars;
unset($_smarty_tpl_vars);
 ?>
<script>
	$(function() {
		$( "#datepicker" ).datepicker({
			showOtherMonths: true,
			selectOtherMonths: true,
			changeMonth: true,
			changeYear: true,
		});
		$( "#datepicker1" ).datepicker({
			showOtherMonths: true,
			selectOtherMonths: true,
			changeMonth: true,
			changeYear: true
		});
		$( "#datepicker2" ).datepicker({
			showOtherMonths: true,
			selectOtherMonths: true,
			changeMonth: true,
			changeYear: true
		});
		$( "#datepicker3" ).datepicker({
			showOtherMonths: true,
			selectOtherMonths: true,
			changeMonth: true,
			changeYear: true
		});
	});
	//上传图片
	$(function(){
		var imgurl=[];
		function createfile(){
			$('#updiv').append("<input type='file'  name='photos' class='upfile'>");
		}
		function showimg(url){
			var img='<img src="'+url+'"/>';
			$('#imglist').append(img);
		}
		function addfile(){
			showimg($(this).val());
			$(this).hide();
			createfile();
			$('.upfile').bind('change',addfile);
		}
		$('.upfile').bind('change',addfile);
	})
</script>


<?php if ($this->_tpl_vars['type'] == 6): ?>
<script type="text/javascript">
	$(document).ready(function(){
		$("#new").hide();
		$("#add").hide();

		$("#add").click(function(){
			var na=$("#new").val();
			$.ajax({
				url:"index.php?a=publish.addajax&name="+na,
				type:"get",
				dataType: "json",
				success: function (msg) {
					if(msg!=""){
						$("#s1").append("<option value='"+msg+"'>"+$("#new").val()+"</option>");
						$("#new").val('');
					}
				}
			});

		});
	});
	function a()
	{
		var val = $("#s1").val();
		if (val == '自定义') {
			$("#new").show();
			$("#add").show();
		} else{
			$("#new").hide();
			$("#add").hide();
		};
	}
</script>
<?php endif; ?>
<script src="static/js/select2.min.js"></script>
<script>
	$(function() {
		$(".select2").select2();
	});
</script>